//
//  ByCellShopCarSettleScoreDeduction.m
//  mijifen_ios
//
//  Created by 朱凯 on 2017/10/27.
//  Copyright © 2017年 itboye. All rights reserved.
//

#import "ByCellShopCarSettleScoreDeduction.h"

@implementation ByCellShopCarSettleScoreDeduction
{
    UILabel     *_contentLabel;
    UISwitch    *_switch;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    // 线条
    UIView *line = [UIView new];
    line.backgroundColor = BY_LINE_COLOR;
    [self.contentView addSubview:line];
    
    // 标题
    _contentLabel = [[UILabel alloc] init];
    _contentLabel.adjustsFontSizeToFitWidth = true;
    _contentLabel.numberOfLines = 1;
    _contentLabel.text = @"可用2000蜜积分抵扣20元";
    _contentLabel.font = FONT(15);
    _contentLabel.textAlignment = NSTextAlignmentLeft;
    _contentLabel.textColor = [UIColor blackColor];
    [self.contentView addSubview:_contentLabel];
    
    // 子标题
    _switch = [[UISwitch alloc] init];
    _switch.onTintColor = BY_THEME_COLOR;
    _switch.thumbTintColor = BY_GOLD_COLOR;
    [self.contentView addSubview:_switch];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.equalTo(@1);
    }];
    [_contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(10);
        make.top.height.equalTo(self);
        make.right.equalTo(_switch.mas_left).offset(-10);
    }];
    [_switch mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@-10);
        make.centerY.equalTo(@0);
    }];

}

@end
